home *** CD-ROM | disk | FTP | other *** search
/ Great Canadian Scientists / GCS_CD.iso / mac / PC / GCSData / memory_g.dxr / 00041_Main Movie Script.ls < prev    next >
Encoding:
Text File  |  1996-09-01  |  8.0 KB  |  347 lines

  1. on startMovie
  2.   global MemoryTesting, Game, time
  3.   GameStart(MemoryTesting)
  4.   preloadMember(78, 80)
  5.   if MemoryTesting = 0 then
  6.     set MemoryTesting to 0.10000000000000001
  7.   end if
  8.   put " " into field "Question"
  9.   set Game to 0
  10.   BHide(26, 27)
  11.   BoxHide(28, 30)
  12. end
  13.  
  14. on OrderWords
  15.   global NumberOfWords, Order
  16.   repeat with count = 1 to NumberOfWords
  17.     put 0 into line count of Order
  18.   end repeat
  19.   repeat with count = 1 to NumberOfWords
  20.     set Temp to random(NumberOfWords)
  21.     repeat while line Temp of Order <> 0
  22.       set Temp to random(NumberOfWords)
  23.     end repeat
  24.     put count into line Temp of Order
  25.   end repeat
  26. end
  27.  
  28. on StartGame
  29.   global Difficulty, BoxUp, NumberOfWords, NumberOfQuestions, UsedUp, Order, TimeStart, timer, QuestionNum, Score1, Score2, stage, Wrong, NoQuiz
  30.   set Wrong to 0
  31.   cursor(4)
  32.   set BoxUp to 0
  33.   set NumberOfWords to 35
  34.   if Difficulty = 0 then
  35.     set NumberOfQuestions to 6
  36.   end if
  37.   if Difficulty = 1 then
  38.     set NumberOfQuestions to 12
  39.   end if
  40.   if Difficulty = 2 then
  41.     set NumberOfQuestions to 18
  42.   end if
  43.   SetBoxes()
  44.   repeat with count = 1 to NumberOfQuestions
  45.     put "No" into line count of UsedUp
  46.   end repeat
  47.   repeat with count = 23 to 40
  48.     resetField(count, 14, "bold", "Helvetica")
  49.   end repeat
  50.   resetField(6, 48, "Bold", "Helvetica")
  51.   resetField(8, 24, "Bold", "Helvetica")
  52.   resetField(22, 18, "Bold", "Helvetica")
  53.   resetField(36, 14, "Bold", "Helvetica")
  54.   OrderWords()
  55.   set Counter to 0
  56.   set QuestionNum to 0
  57.   set Score1 to 0
  58.   set Score2 to 0
  59.   set stage to 0
  60.   set timer to 1
  61.   set TimeStart to the ticks
  62.   set NoQuiz to 1
  63.   cursor(-1)
  64. end
  65.  
  66. on stop
  67.   global NoQuiz, QuizUp, QuizWaiting
  68.   cursor(4)
  69.   put EMPTY into field 6
  70.   set the puppet of sprite 13 to 0
  71.   set the puppet of sprite 4 to 0
  72.   set the puppet of sprite 5 to 0
  73.   set the keyDownScript to EMPTY
  74.   BSuspend(4, 4)
  75.   BSuspend(6, 7)
  76.   BStop()
  77.   go(2)
  78.   ScoreDisplay()
  79.   set NoQuiz to 0
  80.   if QuizWaiting = 1 then
  81.     PopQuiz()
  82.   end if
  83.   cursor(-1)
  84. end
  85.  
  86. on Guess1Setup
  87.   global stage, FieldIn
  88.   set FieldIn to 5
  89.   set stage to 1
  90.   go(6)
  91. end
  92.  
  93. on Guess2Setup
  94.   global stage, Counter
  95.   set Counter to 1
  96.   set stage to 2
  97.   go(8)
  98.   set the puppet of sprite 13 to 1
  99. end
  100.  
  101. on Compute1
  102.   global Wrong, NumberOfQuestions, QuestionNum, Order, UsedUp, Score1, WhatText, Count2, Total, WordsWrong, AllDone
  103.   BSuspend(4, 4)
  104.   set Temp to 0
  105.   set Total to 0
  106.   set WordsWrong to EMPTY
  107.   repeat with count = 1 to NumberOfQuestions
  108.     set Temp to 0
  109.     set WhatText to "Input" & count
  110.     if the text of cast WhatText <> EMPTY then
  111.       set Total to Total + 1
  112.     else
  113.       set Temp to 2
  114.     end if
  115.     repeat with Count2 = 1 to NumberOfQuestions
  116.       if word 1 of the text of cast WhatText = line the value of line Count2 of Order of the text of cast "Words" then
  117.         set Temp to 1
  118.         if line Count2 of UsedUp = "No" then
  119.           set Score1 to Score1 + 1
  120.         end if
  121.         put "Yes" into line Count2 of UsedUp
  122.       end if
  123.     end repeat
  124.     if Temp = 0 then
  125.       set WordsWrong to WordsWrong & line 1 of the text of cast WhatText & ", "
  126.     end if
  127.   end repeat
  128.   delete char the length of WordsWrong of WordsWrong
  129.   delete char the length of WordsWrong of WordsWrong
  130.   set WordsWrong to WordsWrong & "."
  131.   set Msg to "You entered a total of " & Total & " words and out of those, you got " & Score1 & " right."
  132.   if WordsWrong <> "." then
  133.     set Msg to Msg & " The words you entered that were not shown to you were: " & WordsWrong
  134.   end if
  135.   put Msg into field "MsgBox2"
  136.   cursor(-1)
  137.   ShowBox()
  138. end
  139.  
  140. on Compute2
  141.   global NumberOfQuestions, QuestionNum, Order, UsedUp, Score2, Counter
  142.   set Temp to 0
  143.   put Counter
  144.   if word 1 of the text of cast "Input" = line the value of line Counter of Order of the text of cast "Words" then
  145.     if line Counter of UsedUp = "No" then
  146.       set Score2 to Score2 + 1
  147.     end if
  148.     put "Yes" into line Counter of UsedUp
  149.     ShowHint()
  150.     exit
  151.   else
  152.     beep()
  153.     WrongAnswer()
  154.   end if
  155.   put "Yes" into line Counter of UsedUp
  156. end
  157.  
  158. on WrongAnswer
  159.   global Counter, Order
  160.   put "I'm sorry, that is incorrect.  The correct word was " & line the value of line Counter of Order of the text of cast "Words" & "." into field "MsgBox"
  161.   ShowBox()
  162. end
  163.  
  164. on ShowHint
  165.   global NumberOfQuestions, UsedUp, Order, OldCount, Counter
  166.   put EMPTY into field "Input"
  167.   repeat with Counter = 1 to NumberOfQuestions
  168.     if line Counter of UsedUp = "No" then
  169.       put line the value of line Counter of Order of the text of cast "Hints" into field "HintBox"
  170.       exit
  171.     end if
  172.     if Counter = NumberOfQuestions then
  173.       EndGame()
  174.       exit
  175.     end if
  176.   end repeat
  177. end
  178.  
  179. on EndGame
  180.   global Score1, Score2, Total, stage
  181.   set stage to 10
  182.   put "You got " & Score1 & " right without hints and got " & Score2 & " right after having hints!  Your score is " & score() & "." into field "MsgBox"
  183.   ShowBox()
  184. end
  185.  
  186. on score
  187.   global Score1, Score2, Total, stage, MemoryTesting
  188.   set GameScore to (800 * Score1) - (250 * (Total - Score1)) + (500 * Score2)
  189.   if GameScore < 0 then
  190.     set GameScore to 0
  191.   end if
  192.   if GameScore > MemoryTesting then
  193.     set MemoryTesting to GameScore
  194.   end if
  195.   ScoreDisplay()
  196.   return GameScore
  197. end
  198.  
  199. on PassHandler
  200.   global Counter, UsedUp
  201.   WrongAnswer()
  202.   put "Yes" into line Counter of UsedUp
  203. end
  204.  
  205. on SetBoxes
  206.   global NumberOfQuestions
  207.   if NumberOfQuestions = 6 then
  208.     set the visible of sprite 26 to 1
  209.     set the visible of sprite 27 to 1
  210.   end if
  211.   if NumberOfQuestions = 12 then
  212.     set the visible of sprite 26 to 0
  213.     set the visible of sprite 27 to 1
  214.   end if
  215.   if NumberOfQuestions = 18 then
  216.     set the visible of sprite 26 to 0
  217.     set the visible of sprite 27 to 0
  218.   end if
  219. end
  220.  
  221. on Cycle1
  222.   global BoxUp, FieldIn, NumberOfQuestions
  223.   if BoxUp = 0 then
  224.     if (the key = RETURN) or (the key = TAB) then
  225.       if the shiftDown = 0 then
  226.         set FieldIn to FieldIn + 1
  227.         if FieldIn > (NumberOfQuestions + 4) then
  228.           set FieldIn to 5
  229.         end if
  230.         set the editableText of sprite FieldIn to 1
  231.         dontPassEvent()
  232.       else
  233.         set FieldIn to FieldIn - 1
  234.         if FieldIn = 4 then
  235.           set FieldIn to NumberOfQuestions + 4
  236.         end if
  237.         set the editableText of sprite FieldIn to 1
  238.         dontPassEvent()
  239.       end if
  240.     end if
  241.   end if
  242.   if BoxUp = 1 then
  243.     if the key = RETURN then
  244.       ShowBox()
  245.       dontPassEvent()
  246.     end if
  247.   end if
  248. end
  249.  
  250. on Cycle2
  251.   global BoxUp
  252.   if BoxUp = 0 then
  253.     if (the key = RETURN) or (the key = TAB) then
  254.       Compute2()
  255.       dontPassEvent()
  256.       exit
  257.     end if
  258.   end if
  259.   if BoxUp = 1 then
  260.     if the key = RETURN then
  261.       ShowBox()
  262.       dontPassEvent()
  263.       exit
  264.     end if
  265.   end if
  266. end
  267.  
  268. on ShowBox
  269.   global AllDone, BoxUp, stage
  270.   if BoxUp = 1 then
  271.     ClearTrackScripts()
  272.     BSuspend(30, 30)
  273.     set BoxUp to 0
  274.     if stage = 10 then
  275.       BoxHide(28, 30)
  276.       stop()
  277.       exit
  278.     end if
  279.     if stage = 2 then
  280.       go("BoxDown")
  281.       set the keyDownScript to "Cycle2"
  282.       ShowHint()
  283.     end if
  284.     if stage = 1 then
  285.       Guess2Setup()
  286.     end if
  287.     continue()
  288.   else
  289.     BoxTrackScripts()
  290.     set BoxUp to 1
  291.     if stage = 1 then
  292.       BoxShow(28, 30)
  293.     else
  294.       go("BoxUp")
  295.     end if
  296.   end if
  297. end
  298.  
  299. on KeyCheck
  300.   global BoxUp
  301.   if BoxUp = 1 then
  302.     if the key = RETURN then
  303.       ShowBox()
  304.       dontPassEvent()
  305.     end if
  306.   end if
  307. end
  308.  
  309. on idle
  310.   GameIdle()
  311. end
  312.  
  313. on ScientistScreen
  314.   cursor(4)
  315.   go(1, the pathName & "TULVIN_S.DIR")
  316.   cursor(4)
  317. end
  318.  
  319. on HideInfoComplete
  320.   global FieldIn, TempTime
  321.   if (the frame >= 2) and (the frame <= 5) then
  322.     set the timer to TempTime
  323.   end if
  324.   if (the frame >= 8) and (the frame <= 11) then
  325.     set the editableText of sprite 5 to 1
  326.     set the keyDownScript to "Cycle2"
  327.   end if
  328.   if (the frame >= 6) and (the frame <= 7) then
  329.     set the editableText of sprite FieldIn to 1
  330.     set the keyDownScript to "Cycle1"
  331.   end if
  332. end
  333.  
  334. on ShowInfoPrep
  335.   global FieldIn, TempTime
  336.   if (the frame >= 2) and (the frame <= 5) then
  337.     set TempTime to the timer
  338.   end if
  339.   if (the frame >= 8) and (the frame <= 11) then
  340.     set the editableText of sprite 5 to 0
  341.   end if
  342.   if (the frame >= 6) and (the frame <= 7) then
  343.     set the editableText of sprite FieldIn to 0
  344.   end if
  345.   return 1
  346. end
  347.